var member = require('../models/userModel');
var product = require('../models/productModel');
var tpl = require('../templates/product.html');

if (window.console && window.console.log) {
    window.console.log('测试member');
    window.console.log(member);
    window.console.log(_);
    window.console.log($.support.pjax)
    window.console.log(ko);
}

setTimeout(function() {
    document.getElementById('detailId').innerHTML = 'this is a member page.';
    $(document).pjax('a', '#pjax-container');
}, 3000);

setTimeout(function() {
    var arr = [1, 2, 3, 4, 5, 6];
    var even = _.find(arr, function(num) {
        return num % 2 == 0;
    });
    var str = '数组元素：' + arr.join(',') + " even值：" + even;
    $('#underId').show().find('span').eq(1).text(str);
}, 4000);

setTimeout(function() {
    var vm = function() {
        var self = this;
        self.items = ko.observableArray([1, 2, 3, 4, 5]);
    };
    var ele = $('#koId')[0];
    ko.cleanNode(ele);
    ko.applyBindings(vm, ele);
    $('#koId').show();
}, 5000);


setTimeout(function() {
    var render = template.compile(tpl);
    var html = render(product);
    $('#tplId').html(html).show();
}, 6000);
